pub fn odd_fibnacci_sum(threshold: u32) -> u32 {
    fib_iter()
        .take_while(|&x| x < threshold)
        .filter(|&x| x % 2 != 0)
        .sum()
}

fn fib_iter() -> impl Iterator<Item = u32> {
    std::iter::successors(Some((0, 1)), |&(curr, next)| Some((next, curr + next)))
        .map(|(curr, _)| curr)
}
